<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<import type='css' file="Home.Css.Register" />
<load href="__HOMEJS__/Jquery/jquery-1.7.2.min.js" />
<load href="__HOMEJS__/Register.js" />

<title>注册</title></head>
<body onload="document.forms[0].action=window.location.href;">
<form name="form1" method="post" action="__URL__/register" id="form1">
    <div class="top">
        <div class="logo">
            <a href="./">
                <img src="__HOMEIMG__/logo.gif" alt="Panli" /></a></div>
        <div class="hy">
            <img src="__HOMEIMG__/hy.gif" alt="" /></div>
        <div class="T_right">
            <a href="./">返回首页</a><span>|</span><a href="./Help.aspx">帮助信息</a>
        </div>
    </div>
   <div class="box">
        
         <script type="text/javascript">

            function emailInputShow(e) {
                if (e && e.stopPropagation) {
                    e.stopPropagation();
                }
                else {
                    window.event.cancelBubble = true;
                }
                $('#bgdiv').show();
                $("#changeEmail").show(0, function () { $("#codeImage").click(); });
                $("#changeEmailCode").val("");
                $("#cEmail").removeAttr("class").text("此邮箱将作为您登录PreorderChina的帐号！");
                $("#cemailinput").val("");
            }

            function changeEmail(e) {
                if (e && e.stopPropagation != undefined) { e.stopPropagation(); }
                else { window.event.cancelBubble = true; }

                var checkCode = $.trim($("#changeEmailCode").val());
                if (checkCode.length <= 0) {
                    $("#cEmail").attr("class", "red").text("请输入验证码！"); return;
                }
				changeEmailSuc();
            }


            function changeEmailSuc() {
                var email = $("#cemailinput").val();
                if (email.length <= 0) { $("#cEmail").attr("class", "red").text("请输入您的Email地址！"); return; }
                var reg = new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
                if (reg.test($("#cemailinput").val())) {
                    $.ajax({
                        type: "POST",
                        url: "__URL__/regReSendActivationEmail",
                        dataType: "text",
                        data: {uid:'<?php echo $uid?>',email:email},
                        timeout: 10000,
                        beforeSend: function () { $("#cEmail").attr("class", "lv").text("正在修改您的Email，请稍候！"); $("#changeEmailBtn").attr("disabled", "disabled"); },
                        error: function () { $("#cEmail").attr("class", "red").text("网络连接失败！"); $("#changeEmailBtn").removeAttr("disabled"); },
                        success: function (res) {
                            var rstr = eval("(" + res + ")").info;
                            if (rstr == "error") { window.location = "/"; return; }
                            else if (rstr == "used") { $("#cEmail").attr("class", "red").text("该Email地址已经被使用！"); }
                            else if (rstr == "noUser") { $("#cEmail").attr("class", "red").text("Email地址修改失败！"); }
                            else if (rstr == "again") { $("#cEmail").attr("class", "red").text("您操作过于频繁，请过10分钟后再试！"); }
                            else if (rstr == "success" || rstr == "fail") { $("#cEmail").text("已成功修改您的Email并发送新的激活邮件，请注意查收！"); $("#changeEmail").hide(); $("#registerEmail").html(email); $("#successChange").show(); }
                            else if (rstr == "wrong") { $("#cEmail").attr("class", "red").text("您输入的Email地址格式不正确！"); }
							else{
								$("#cEmail").attr("class", "red").text(rstr);
							}
                            $("#changeEmailBtn").removeAttr("disabled");
                        }
                    });
                }
                else {
                    $("#cEmail").attr("class", "red").text("您输入的Email地址不正确！");
                }
            }

            function reSendEmail() {
                $.ajax({
                    type: "POST",
                    url: "__URL__/regReSendActivationEmail",
                    dataType: "text",
                    data: {uid:'<?php echo $uid?>'},
                    timeout: 10000,
                    error: function () { alert("网络连接失败，请稍后再试！"); },
                    success: function (res) { 
						var resStr = eval("(" + res + ")").info; 
						if (resStr == "success") {
							alert("新的激活邮件已经发送到您的邮箱，请注意查收！"); 
						} else { 
							if (resStr == "again") 
								alert("您发送邮件过于频繁，请过10分钟后再试"); 
							else { 
								if (resStr == "approved") { 
									alert("您的帐号已经激活！请前往登陆"); 
									window.location = "__URL__/login/";
								} 
									else alert("激活邮件发送失败！"); 
							} 
						} 
					}
                });
            }


            $(document).ready(function () {
                $("#changeEmail").click(function (e) { if (e && e.stopPropagation) { e.stopPropagation(); } else { window.event.cancelBubble = true; } });
                $("#successChange").click(function (e) { if (e && e.stopPropagation) { e.stopPropagation(); } else { window.event.cancelBubble = true; } });
                $(document).click(function (e) {
                    if ($("#changeEmail:hidden").length > 0) {
                        //if ($.trim($("#cemailinput").val()).length == 0) $("#cemailinput").attr("class", "c1").val("请输入Email地址");
                        $("#cEmail").removeAttr("class").text("此邮箱将作为您登录Panli的帐号！");
                    } $("#changeEmail").hide(); $('#bgdiv').hide(); $("#successChange").hide();
                });
            });
        </script>
        <div class="move">
            <img alt="激活帐户" src="__HOMEIMG__/move2.gif"></div>
        <div class="activation">
            <div class="mail">
                <h2>
                    系统已向您的邮箱<span id="registerEmail">{$email}</span>发送验证邮件</h2>
                <dl>
                    <dt>点击邮件中的链接地址，即可完成激活账户！</dt>
                    
                </dl>
            </div>
            <div class="operate">
                <h2>
                    如果长时间未收到邮件，您可以尝试：</h2>
                <ul>
                    <li>查看邮箱的垃圾箱或广告箱，邮件可能被误放入其中；</li>
                    <li>如果一直无法找到验证邮件，可点击<a onclick="reSendEmail()" href="javascript:void(0);">重新发送</a>；</li>
                    <li>您也可以<a href="javascript:void(0);" onclick="emailInputShow(event)">更换其他邮箱</a> ，再收验证邮件。</li>
                </ul>
                <div style="display: none;" id="bgdiv" class="floor">
                </div>
                <div style="display: none" class="change" id="changeEmail">
                    <a title="关闭" class="close" onclick="$('#changeEmail').hide();$('#bgdiv').hide();" href="javascript:;"></a>
                    <p id="cEmail">此邮箱将作为您登录Preorder China的帐号！</p>
                    <table>
                        <tbody><tr>
                            <td class="zuo">
                                邮箱地址：
                            </td>
                            <td>
                                <input type="text" class="c1" id="cemailinput">
                            </td>
                        </tr>
                        <tr>
                            <td class="zuo">
                                验证码：
                            </td>
                            <td>
                                <input type="text" id="changeEmailCode" class="c3"><img border="0" onclick="this.src='__URL__/verify/t='+Math.random();" style="vertical-align:middle;cursor:pointer;" alt="验证码" title="点击图片刷新" src="__URL__/verify" id="codeImage">
                            </td>
                        </tr>
                    </tbody></table>
                    <input type="button" onmouseout="this.className='c2'" onmouseover="this.className='c2_'" value="确定发送" name="" onclick="changeEmail(event);" class="c2" id="changeEmailBtn">
                </div>
                <div style="display: none" class="change" id="successChange">
                    <a title="关闭" class="close" onclick="$('#successChange').hide();$('#bgdiv').hide();" href="javascript:;"></a>
                    <div class="ch_top">
                        已向您的新邮箱发送验证邮件！<br>
                        点击邮件中的链接地址，即可完成验证！
                    </div>
                    <p class="tishi">
                        此邮箱将作为您登录PreorderChina的帐号！</p>
                </div>
            </div>
        </div>
        
    </div>
    <div class="bottom">
    </div>
    <div class="foot">
        <p>
            <a href="#" target="_blank">关于Panli</a>&nbsp;|&nbsp;
			<a href="#">联系我们</a>&nbsp;|&nbsp;
        </p>
        Copyright &copy;2012 Preorderchina Inc. All rights reserved.
    </div>
    </form>
</body>
</html>
